package cn.leelei.springmvc.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.HttpRequestHandler;

/**
 * 实现 HttpRequestHandler 接口
 * 类似于原生servlet
 * @author Administrator
 *
 */
public class LoginControllerHttpRequestHandler implements HttpRequestHandler {

	@Override
	public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {

		// 获得页面的提交参数
		String userName = request.getParameter("userName");
		String passWord = request.getParameter("passWord");

		if ("admin".equals(userName) && "admin".equals(passWord)) {
			response.sendRedirect("views/success.jsp");
		} else {
			response.sendRedirect("views/fail.jsp");
		}
	}

}
